package com.easybuy.service.impl;

import com.easybuy.bean.EasybuyComment;
import com.easybuy.mapper.EasybuyCommentMapper;
import com.easybuy.service.ICommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImpl implements ICommentService {
    @Autowired
    EasybuyCommentMapper easybuyCommentMapper;
    //显示后台的分页显示
    @Override
    public List<EasybuyComment> listBypage(int page, int pageSize){
        int from = (page-1)*pageSize;
        return easybuyCommentMapper.listByPage(from,pageSize);
    }
    //显示前台的分页显示
    @Override
    public List<EasybuyComment> listHomeBypage(int page, int pageSize){
        int from = (page-1)*pageSize;
        return easybuyCommentMapper.listByPage(from,pageSize);
    }
    @Override
    public int save(EasybuyComment easybuyComment){
        return  easybuyCommentMapper.save(easybuyComment);
    }
    //统计数据页数的方法
    @Override
    public int countAll(){
        return easybuyCommentMapper.countAll();
    }

   @Override
    public EasybuyComment selectByComment(Integer ecId){
        return  easybuyCommentMapper.selectByid(ecId);
    }
    //（修改）回复
    @Override
    public int updateById(EasybuyComment easybuyComment){return easybuyCommentMapper.upateByPk(easybuyComment);}
    //删除操作
    @Override
    public int deleteByPk(int id){
        return easybuyCommentMapper.deleteByPk(id);
    }

}
